#include <QDebug>
#include "threadofwebclientsocket.h"
#include "webclientsocket.h"

ThreadOfWebClientSocket::ThreadOfWebClientSocket(int paramSocketID,
               QString strDefaultPage,QObject *parent) :QThread(parent)
{
    socketID=paramSocketID;
    webClientSocket=NULL;
    defaultPage=strDefaultPage;
}

void ThreadOfWebClientSocket::run()
{
    webClientSocket=new WebClientSocket(socketID,defaultPage);
    connect(webClientSocket,SIGNAL(disconnected()),this,SLOT(slotDestroy()));
    exec();
}

ThreadOfWebClientSocket::~ThreadOfWebClientSocket()
{
    exit(0);
    wait(500);
    webClientSocket->deleteLater();
    //qDebug()<<"One Thread of webclientsocket deleted";
}

void ThreadOfWebClientSocket::slotDestroy()
{
    deleteLater();
}
